﻿/**
 * ...
 * @author sminutoli
 */
import com.dmotiko.prune.*
import com.dmotiko.general.*
 
class StoresBar extends SiteBar
{
	
	public static var BSAS:String = "stores_bsas";
	public static var INTERIOR:String = "stores_interior";
	public static var INTERNACIONAL:String = "stores_internacional";
	
	private function initClip():Void {
		super.initClip();				
		sLink = "MainSubBtn";
		setData( [ 
			{ label: "ARGENTINA" }, 
			{ label: "   BUENOS AIRES", value: BSAS },
			{ label: "   INTERIOR", value: INTERIOR },
			{ label: "", value: "empty" },
			{ label: "INTERNACIONAL", value: INTERNACIONAL }
		] );
	}
	
	private function section_changed(e):Void {
		if ( e.section == SiteSections.STORES ) {
			btns[0].useHandCursor = false;
			btns[0].onRelease = function() { };
			btns[0].onRollOver();
			btns[0].setActive(true, true);
			btn_active = undefined;
			btns[1].onRelease();
			this._x = 63;
			this._y = 325;
			show();
		} else {
			hide();
			if( Site.getApp().getClips().getStores().isShowed() ) Site.getApp().getClips().getStores().hide();
		}
	}
	
	private function createBtns():Void {
		super.createBtns();
		getBtnByValue("empty").enabled = false;
	}
	
	private function btn_changed( e ):Void 
	{
		var btn = e.target;
		if ( btn && btn != btn_active ) {
			btn_active.setActive( false, true );
			btn_active = btn;
			if ( btn_active._currentframe == 1 ) btn_active.onRollOver();
			btn_active.setActive( true, true );
		}
		
		if ( e.data.value == INTERNACIONAL ) {
			btns[0].setActive(false, true);
		} else {
			btns[0].onRollOver();
			btns[0].setActive(true, true);
		}
		
		Site.getApp().getClips().getStores().setData( e.data.value );
		
	}
	
}